pluginEnabled("Blog")) { return false; } $BlogPlugin = $PluginMgr->getPlugin("Blog"); if ($BlogPlugin->getBlogIdByName("News") === false) { return false; } return true; } /** * Print rows of new resource. */ function PrintNewResourceTableRows() { global $MoreResources; global $ResourceOffset; $MaxDescriptionLength = 250; $MaxUrlLength = 60; if (is_null($ResourceOffset)) { $ResourceOffset = 0; } # default values $MaxNumberOfResourcesToDisplay = SystemConfiguration::getInstance() ->getInt("NumResourcesOnHomePage"); $MaxNumberOfDaysToGoBackForResources = 7300; # retrieve resources using factory # NOTE: Retrieves one more resource than is needed because we need # to know if there are more resources.) $ResourceFact = new RecordFactory(); $Resources = $ResourceFact->GetRecentlyReleasedRecords( ($MaxNumberOfResourcesToDisplay + 1), $ResourceOffset, $MaxNumberOfDaysToGoBackForResources ); # determine whether "Previous" link should be displayed $ResourceCount = count($Resources); $MoreResources = ($ResourceCount <= $MaxNumberOfResourcesToDisplay) ? false : true; # if resources found if ($ResourceCount) { # drop last resource if we have one more than is needed if ($ResourceCount > $MaxNumberOfResourcesToDisplay) { array_pop($Resources); } $User = User::getCurrentUser(); # for each resource foreach ($Resources as $Resource) { # display resource PrintNewResourceRow( $Resource, $Resource->GetViewPageUrl(), $Resource->UserCanEdit($User), $Resource->GetEditPageUrl(), $Resource->ScaledCumulativeRating() ); } } else { # print row with "no resources" notice print "

No new resources

"; } } /** * Print the row for a record in the resource summary table. */ function PrintNewResourceRow( $Resource, $FullRecordLink, $EditOkay, $EditLink, $CumulativeRating ): void { $Summary = ResourceSummary::create($Resource->id()); $Summary->editable($EditOkay); $Summary->display(); } /** * Check if next reources are available. * @return TRUE if they are, FALSE otherwise. */ function NextResourcesAvailable() { global $ResourceOffset; $NumResources = SystemConfiguration::getInstance()->getInt("NumResourcesOnHomePage"); return ($ResourceOffset >= $NumResources) ? true : false; } /** * Check if previouss are available. * @return TRUE if they are, FALSE otherwise. */ function PreviousResourcesAvailable() { global $MoreResources; return ($MoreResources > 0); } /** * Print link for the previous resource. */ function PrintPrevResourceLink() { global $ResourceOffset; $NumResources = SystemConfiguration::getInstance()->getInt("NumResourcesOnHomePage"); $Offset = $ResourceOffset + $NumResources; print "index.php?P=Home&ResourceOffset=".$Offset; } /** * Print the link for the next resource. */ function PrintNextResourceLink() { global $ResourceOffset; $NumResources = SystemConfiguration::getInstance()->getInt("NumResourcesOnHomePage"); $Offset = $ResourceOffset - $NumResources; print "index.php?P=Home&ResourceOffset=".$Offset; } # ----- MAIN ----------------------------------------------------------------- # non-standard global variables global $AnnouncementOffset; global $MoreResources; global $ResourceOffset; global $ReleaseResourceTotal; $SysConfig = SystemConfiguration::getInstance(); # get the total number of released resources if ($SysConfig->getBool("ShowNumResourcesEnabled")) { $ResourceFactory = new RecordFactory(); $ReleaseResourceTotal = $ResourceFactory->getReleasedRecordTotal(); } $ResourceOffset = isset($_GET["ResourceOffset"]) ? intval($_GET["ResourceOffset"]) : 0; # retrieve any announcement content ob_start(); $GLOBALS["AF"]->SignalEvent( "EVENT_HTML_INSERTION_POINT", [ $GLOBALS["AF"]->GetPageName(), "Blog Entries", [ "Blog Name" => "News", "Max Entries" => $SysConfig->getInt("NumAnnounceOnHomePage") ] ] ); $Announcements = ob_get_contents(); ob_end_clean(); // phpcs:disable Generic.Files.LineLength.MaxExceeded ?>

# Announcements

New Resources HasPriv(PRIV_RESOURCEADMIN, PRIV_COLLECTIONADMIN)) { ?> Add Resource getBool("ShowNumResourcesEnabled")) { ?> Currently: Resources